package com.xiaotu.yapi.controller;

import com.xiaotu.yapi.common.CommonResult;
import com.xiaotu.yapi.vo.UserVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * TODO
 * TODO
 *
 * @author Mr.zhang
 * @module TODO
 * @date 2022/1/8 14:57
 * @copyright 2021 barm Inc. All rights reserved
 */
@CrossOrigin
@RestController
@RequestMapping("user")
@Slf4j
public class UserController {

    /**
     *
     * @param userName
     * @param sss
     * @return
     */
    @GetMapping("getUserName/{userName}")
    public String getUserName(@PathVariable("userName") String userName, String sss) {
        System.out.println(userName);
        return userName;
    }

    /**
     * 添加用户接口
     *
     * @param userName 用户名
     * @param sex      性别
     * @return
     * @tag 查询
     */
    @GetMapping("addUser")
    public CommonResult<UserVo> addUser(String userName, Integer sex) {
        log.info("用户名：{}，性别{}", userName, sex);
        return CommonResult.sucess(new UserVo(userName, sex));
    }

    /**
     * @throws
     * @tag
     * @title
     * @description
     * @author Mr.zhang
     * @updateTime 2022/1/8 14:30
     */
    @GetMapping("addUser2")
    public CommonResult<UserVo> addUser2(String userName, Integer sex) {
        log.info("用户名：{}，性别{}", userName, sex);
        return CommonResult.sucess(new UserVo(userName, sex));
    }

}
